package com.litian.dancechar.core.example.controller;

import com.litian.dancechar.core.feign.base.client.BaseServiceClient;
import com.litian.dancechar.core.feign.base.dto.SysWhiteListReqDTO;
import com.litian.dancechar.core.feign.base.dto.SysWhiteListRespDTO;
import com.litian.dancechar.framework.common.base.RespResult;
import com.litian.dancechar.framework.common.base.RespResultCode;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * example业务处理
 *
 * @author litian
 * @date 2021/6/19 11:17
 */
@Api(value = "example相关controller")
@RestController
@Slf4j
@RequestMapping(value = "/example/")
public class ExampleController {
    @Resource
    private BaseServiceClient baseServiceClient;

    @ApiOperation(value = "查询白名单列表", notes = "查询白名单列表")
    @PostMapping("findList")
    public RespResult<List<SysWhiteListRespDTO>> findList(@RequestBody SysWhiteListReqDTO req) {
        try {
            return baseServiceClient.findList(req);
        } catch (Exception e) {
            log.error("查询白名单列表系统异常!errMsg:{}", e.getMessage(), e);
            return RespResult.error(RespResultCode.SYS_EXCEPTION);
        }
    }
}